/*
 * Copyright (c) 2010, Yawning <yawninglol at gmail.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   * Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 *   * Neither the name of the Mew Developers nor the
 *     names of its contributors may be used to endorse or promote products
 *     derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

package yawning.mew;

import java.util.Properties;

import yawning.mew.PropertiesBase;

/**
 * Holds all the user provided buffs/debuffs that we are going to model.
 *
 * @author Yawning <yawninglol at gmail.com>
 */
public class BuffsDebuffs extends PropertiesBase {
    public enum Debuff implements IProperty {
        ARMOR("Debuff.Armor", "false"),       // Armor Debuff (Major): Acid Spit (exotic Hunter pet), Scorpid Venom (Hunter), Expose Armor, Sunder Armor, Fairie Fire (12%)
        BLEEDDMG("Debuff.BleedDmg", "false"), // Bleed Damage Increase Debuff: Mangle, Trauma, Hemo (30%)
        PHYSVULN("Debuff.PhysVuln", "false"), // Physical Vulnerability Debuff: Blood Frenzy, Savage Combat, Brittle Bones (Frost DK talent) (4%)
        SHATTERINGTHROW("Debuff.ShatteringThrow", "false"); // Shattering throw Debuff: Shattering Throw (-20% Armor for 10 sec, 5 min CD)

        private final String propertyKey;
        private final String defaultValue;

        private Debuff(String k, String v) {
            propertyKey = k;
            defaultValue = v;
        }

        public String getKey() {
            return this.propertyKey;
        }

        public String getDefault() {
            return this.defaultValue;
        }
    }

    public enum Buff implements IProperty {
        MELEEHASTE("Buff.MeleeHaste", "false"), // Melee Haste Buff: Improved Icy Talons, Windfury Totem, Swift Retribution - Will now only increase your auto-attack speed without increasining your resource gain (Energy, RP etc) except possibly Rage due to how Warriors gain it. (10%)
        CRIT("Buff.Crit", "false"),             // Melee AND Spell Critical Strike Chance Buff: Leader of the Pack (the heal is now Druid only), Rampage, Moonkin Aura, Honor among Thieves, Elemental Oath - (Melee and Spell crit buffs got merged)
        APMULT("Buff.APMult", "false"),         // Attack Power Buff (Multiplier): Abomination's Might, Trueshot Aura, Unleashed Rage, Blessing of Might (10%)
        DAMAGEMULT("Buff.DamageMult", "false"), // Percentage Damage Increase: Ferocious Inspiration, Sanctified Retribution, Arcane Empowerment (3%)
        STATMULT("Buff.StatMult", "false"),     // Stat Multiplier Buff: Blessing of Kings, Mark of the Wild (both buffs reduced to +5% and it does not increase the Spirit stat anymore; in addition to this it now gives +resistances (+214 @82, scales with level))
        AGISTR("Buff.AgiStr", "false"),         // Agility and Strength Buff: Strength of Earth Totem, Horn of Winter, Battle Shout (1395@85)

        // Uptime based buffs.
        TRICKSOFTHETRADE("Buff.TricksOfTheTrade", "false"), // Tricks of the Trade: +15% damage for 6 sec.
        UNHOLYFRENZY("Buff.UnholyFrenzy", "false"),         // Unholy Frenzy: Melee/Ranged Haste (20%/30 sec)
        DARKINTENT("Buff.DarkIntent", "false"),             // Dark Intent: +3% Haste.  +3/6/9% Periodic Damage (7 sec after DoT crit.)
        MAJORHASTE("Buff.MajorHaste", "false");             // Major Haste Buff: Bloodlust, Magelust (30%/40 sec)

        private final String propertyKey;
        private final String defaultValue;

        private Buff(String k, String v) {
            propertyKey = k;
            defaultValue = v;
        }

        public String getKey() {
            return this.propertyKey;
        }

        public String getDefault() {
            return this.defaultValue;
        }
    }

    protected BuffsDebuffs() {
    }

    public BuffsDebuffs(Properties props) {
    	super(props);
    }

    public BuffsDebuffs(BuffsDebuffs bd) {
    	super(bd);
    }

    //
    // Debuff related goo.
    //

    public boolean isDebuff(Debuff d) {
        return getBool(d);
    }

    public void setDebuff(Debuff d, boolean v) {
        setBool(d, v);
    }

    //
    // Buff related goo.
    //

    public boolean isBuff(Buff b) {
        return getBool(b);
    }

    public void setBuff(Buff b, boolean v) {
        setBool(b, v);
    }

    @Override
    public String toString() {
        StringBuilder rval = new StringBuilder();
        rval.append(valuesToString(Debuff.values()));
        rval.append(valuesToString(Buff.values()));
        return rval.toString();
    }
}
